package com.cuijq.ms.statedesign.v4.impl;

import com.cuijq.ms.statedesign.v4.IMario;
import com.cuijq.ms.statedesign.v4.MarioStateMachine;
import com.cuijq.ms.statedesign.v4.State;
import com.cuijq.ms.statedesign.v4.impl.SuperMario;

/**
 * @author by CuiJQ
 * @Classname SmallMario
 * @Description SmallMario Description
 * @Date 2021/5/29 16:13
 */
public class SmallMario implements IMario {

  private MarioStateMachine stateMachine;

  SmallMario(MarioStateMachine stateMachine) {
    this.stateMachine = stateMachine;
  }

  @Override
  public State getName() {
    return State.SMALL;
  }

  @Override
  public void obtainMushRoom() {
    stateMachine.setCurrentState(new SuperMario(stateMachine));
    stateMachine.setScore(stateMachine.getScore() + 100);
  }

  @Override
  public void obtainCape() {
    stateMachine.setCurrentState(new CapeMario(stateMachine));
    stateMachine.setScore(stateMachine.getScore() + 200);
  }

  @Override
  public void obtainFireFlower() {
    stateMachine.setCurrentState(new FireMario(stateMachine));
    stateMachine.setScore(stateMachine.getScore() + 300);
  }

  @Override
  public void meetMonster() {

  }
}
